package org.zachary.creditbusiness.hotel.service.impl;

import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.zachary.creditbusiness.hotel.entity.RoomType;
import org.zachary.creditbusiness.hotel.exception.BusinessException;
import org.zachary.creditbusiness.hotel.mapper.RoomTypeMapper;
import org.zachary.creditbusiness.hotel.service.RoomTypeService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.util.List;

@Service
public class RoomTypeServiceImpl extends ServiceImpl<RoomTypeMapper, RoomType>
        implements RoomTypeService {

    @Override
    public List<RoomType> getByHotelId(Integer hotelId) {
        // 参数校验
        if (hotelId == null) {
            throw new BusinessException("酒店ID不能为空");
        }
        // 根据 hotel_id 查询
        QueryWrapper<RoomType> qw = new QueryWrapper<>();
        qw.eq("hotel_id", hotelId);
        return baseMapper.selectList(qw);
    }
}